package com.cskaoyan.demo;

import com.cskaoyan.Account;
import com.cskaoyan.utils.DruidUtils;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import java.sql.SQLException;
import java.util.List;

// beanListHandler
public class QueryRunnerDemo3 {

    public static void main(String[] args) throws SQLException {

        QueryRunner queryRunner = new QueryRunner(DruidUtils.getDataSource());

        List<Account> accounts = queryRunner.query("select * from account",new BeanListHandler<>(Account.class));

        System.out.println(accounts);

    }
}
